<template>
  <div>
    <van-nav-bar
      title="我的地址"
      left-text="返回"
      right-text="确定"
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    />
    <van-address-list
      title="我的地址"
      v-model="chosenAddressId"
      :list="addressList"
      :disabled-list="disabledList"
      disabled-text="以下地址超出配送范围"
      default-tag-text="默认"
      @add="onAdd"
      @edit="onEdit"
    />
  </div>
</template>

<script>
import { Toast } from "vant";
import { areaList } from "@vant/area-data";
import { mapGetters, mapActions } from "vuex";
export default {
  data() {
    return {
      chosenAddressId: "1",
      // list: [
      //   {
      //     id: "3",
      //     name: "王五",
      //     tel: "13200000000",
      //     address: "浙江省杭州市滨江区江南大道 15 号",
      //   },
      // ],
      disabledList: [
        {
          id: "3",
          name: "王五",
          tel: "1320000000",
          address: "浙江省杭州市滨江区江南大道 15 号",
        },
      ],
    };
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    onClickRight() {
      this.$router.push({ path: "./cart" });
    },
    onAdd() {
      this.$router.push({ path: "./addAddress" });
    },
    onEdit(item, index) {
      this.$router.push({ path: "./addAddress", query: { index } });
      console.log("index>>>", index);
    },
  },
  computed: {
    ...mapGetters(["addressList"]),
  },
};
</script>

<style>
</style>